﻿#region Using Statements
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Media;
#endregion

namespace SpaceKinect
{
    /// <summary>
    /// Screen to select difficulty of game
    /// </summary>
    class DifficultySelectScreen : MenuScreen
    {
        #region Fields
        MenuEntry Easy;
        MenuEntry Medium;
        MenuEntry Hard;

        int[] difficulty = new int[4];

        #endregion

        #region Initialization

        /// <summary>
        /// Constructor.
        /// </summary>
        public DifficultySelectScreen() : base("Difficulty")
        {
            // Create menu entries.
            Easy = new MenuEntry(string.Empty);
            Medium = new MenuEntry(string.Empty);
            Hard = new MenuEntry(string.Empty);
            SetMenuEntryText();

            MenuEntry back = new MenuEntry("Back");

            // Hook up menu event handlers.
            Easy.Selected += EasyMenuEntrySelected;
            Medium.Selected += MediumMenuEntrySelected;
            Hard.Selected += HardMenuEntrySelected;
            back.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(Easy);
            MenuEntries.Add(Medium);
            MenuEntries.Add(Hard);
            MenuEntries.Add(back);
        }


        /// <summary>
        /// Fill in the latest values for the options screen menu text.
        /// </summary>
        void SetMenuEntryText()
        {
            Easy.Text = "Easy";
            Medium.Text = "Medium";
            Hard.Text = "Hard";
        }

        #endregion

        #region Handle Input


        /// <summary>
        /// Event handler for when 'easy' is selected
        /// </summary>
        void EasyMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {

            //mapwidth, mapheight, number of asteroids, initial gamespeed
            int[] difficulty = { 10, 7, 1, 3 };
            LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen("Easy"));
        }

        /// <summary>
        /// Event handler for when 'medium' is selected
        /// </summary>
        void MediumMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            int[] difficulty = {8, 6, 30, 6};
            LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen("Medium"));
        }

        /// <summary>
        /// Event handler for when 'hard' is selected
        /// </summary>
        void HardMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            int[] difficulty = { 6, 5, 40, 9};
            LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen("Hard"));
        }

        #endregion
    }
}
